// 菜单栏代码
// 2007-4-18

Ext.menu.Menubar = function(config){
	Ext.applyIf(config, {
		plain: true,
		cls: ""
	});
    Ext.menu.Menubar.superclass.constructor.call(this, config);
    this.cls += " x-menubar";
    if (this.orientation == "vertical") {
	    this.subMenuAlign = "tl-tr?";
	    this.cls += " x-vertical-menubar";
    } else {
    	this.subMenuAlign = "tl-bl?";
	    this.cls += " x-horizontal-menubar";
    }
};

Ext.extend(Ext.menu.Menubar, Ext.menu.Menu, {
    minWidth : 120,
    shadow : false,
    orientation: "horizontal",

	hide: function(){
        if(this.activeItem){
			this.activeItem.deactivate();
			delete this.activeItem;
	        this.fireEvent("beforehide", this);
        }
	},

    onClick : function(e){
    	if (this.activeItem) {
            this.activeItem.deactivate();
            delete this.activeItem;
	        this.fireEvent("beforehide", this);
    	}
    	else {
	        var t;
	        if (t = this.findTargetItem(e)){
	            if(t.canActivate && !t.disabled){
	                this.setActiveItem(t, true);
	            }
	        }
	        this.fireEvent("click", this, e, t);
	    }
    },

    onMouseOver : function(e){
    	if (this.activeItem) {
	        var t;
	        if(t = this.findTargetItem(e)){
	            if(t.canActivate && !t.disabled){
	                this.setActiveItem(t, true);
	            }
	        }
	        this.fireEvent("mouseover", this, e, t);
	    }
    },

    onMouseOut : function(e){}
    
});
